package com.jx.driving.transmission;

import com.jx.driving.domain.GnssPackage;
import com.jx.driving.message.TimeTerminalTransmissionMessage;
import com.jx.driving.protocol.terminal.annotation.ByteAnnotation;
import com.jx.driving.protocol.terminal.annotation.DwordAnnotation;
import com.jx.driving.protocol.terminal.annotation.LimitedStringAnnotation;
import com.jx.driving.protocol.terminal.annotation.ObjectAnnotation;
import com.jx.driving.protocol.terminal.annotation.TerminalAnnotation;
import com.jx.driving.protocol.terminal.annotation.WordAnnotation;
import com.jx.driving.request.domain.LocationAttachement;

import java.util.ArrayList;
import java.util.List;

/**
 * 照片上传初始化
 *
 * @author shenliuyang
 * <p>
 * 2016年8月15日下午2:39:11
 */
@TerminalAnnotation
public class Terminal0x0305TransmissionBack extends TimeTerminalTransmissionMessage {
    @LimitedStringAnnotation(value = 10, order = 1)
    private String imageNo;// 照片编号
    @LimitedStringAnnotation(value = 16, order = 2)
    private String userNo;// 学员编号
    @ByteAnnotation(order = 3)
    private short uploadType;// 上传模式
    @ByteAnnotation(order = 4)
    private short cameraChannel;// 摄像头通道号
    /**
     * 0x01：320×240； 0x02：640×480； 0x03：800×600； 0x04：1024×768； 0x05：176×144[Qcif]； 0x06：352×288[Cif]； 0x07：704×288[HALF D1]； 0x08：704×576[D1]； 注：终端若不支持系统要求的分辨率，则取最 接近的分辨率拍摄并上传
     */
    @ByteAnnotation(order = 5)
    private short size;// 图片尺寸

    /**
     * 发起图片的事件类型，定义如下： 0：中心查询的图片； 1：紧急报警主动上传的图片；2：关车门后达到指定车速主动上传的图片； 3：侧翻报警主动上传的图片； 4：上客； 5：定时拍照； 6：进区域； 7：出区域； 8：事故疑点(紧急刹车)； 9：开车门； 17：学员登录拍照； 18：学员登出拍照； 19：学员培训过程中拍照
     */
    @ByteAnnotation(order = 6)
    private short eventType;
    @WordAnnotation(order = 7)
    private int packageCount;// 总包数
    @DwordAnnotation(order = 8)
    private long dataLength;// 照片数据大小
    @DwordAnnotation(order = 9)
    private long classId;// 课堂 ID
    @ObjectAnnotation(order = 10)
    private GnssPackage gnss;// 卫星定位数据包
    @ObjectAnnotation(order = 11)
    private LocationAttachement att1;
    @ObjectAnnotation(order = 12)
    private LocationAttachement att2;
    @ObjectAnnotation(order = 13)
    private LocationAttachement att3;
    @ObjectAnnotation(order = 14)
    private LocationAttachement att4;
    @ByteAnnotation(order = 12)
    private short trustable;// 人脸识别置信度 0-100，数值越大置信度越高

    public String getImageNo() {
        return imageNo;
    }

    public void setImageNo(String imageNo) {
        this.imageNo = imageNo;
    }

    public String getUserNo() {
        return userNo;
    }

    public void setUserNo(String userNo) {
        this.userNo = userNo;
    }

    public short getUploadType() {
        return uploadType;
    }

    public void setUploadType(short uploadType) {
        this.uploadType = uploadType;
    }

    public short getCameraChannel() {
        return cameraChannel;
    }

    public void setCameraChannel(short cameraChannel) {
        this.cameraChannel = cameraChannel;
    }

    public short getSize() {
        return size;
    }

    public void setSize(short size) {
        this.size = size;
    }

    public short getEventType() {
        return eventType;
    }

    public void setEventType(short eventType) {
        this.eventType = eventType;
    }

    public int getPackageCount() {
        return packageCount;
    }

    public void setPackageCount(int packageCount) {
        this.packageCount = packageCount;
    }

    public long getDataLength() {
        return dataLength;
    }

    public void setDataLength(long dataLength) {
        this.dataLength = dataLength;
    }

    public long getClassId() {
        return classId;
    }

    public void setClassId(long classId) {
        this.classId = classId;
    }

    public GnssPackage getGnss() {
        return gnss;
    }

    public void setGnss(GnssPackage gnss) {
        this.gnss = gnss;
    }

    public short getTrustable() {
        return trustable;
    }

    public void setTrustable(short trustable) {
        this.trustable = trustable;
    }

    public List<LocationAttachement> getAttachementList() {
        List<LocationAttachement> result = new ArrayList<>();
        result.add(att1);
        result.add(att2);
        result.add(att3);
        result.add(att4);
        return result;
    }

    public void setAttachementList(List<LocationAttachement> attachementList) {
        this.att1 = attachementList.get(0);
        this.att2 = attachementList.get(1);
        this.att3 = attachementList.get(2);
        this.att4 = attachementList.get(3);
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("Terminal0x0305Transmission [imageNo=").append(imageNo).append(", userNo=").append(userNo)
                .append(", uploadType=").append(uploadType).append(", cameraChannel=").append(cameraChannel)
                .append(", size=").append(size).append(", eventType=").append(eventType).append(", packageCount=")
                .append(packageCount).append(", dataLength=").append(dataLength).append(", classId=").append(classId)
                .append(", gnss=").append(gnss).append(", attachementList=").append(getAttachementList())
                .append(", trustable=").append(trustable).append("]");
        return builder.toString();
    }

}
